package com.qinggeng.project.system.controller;

import com.github.pagehelper.PageInfo;
import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.project.system.domain.*;
import com.qinggeng.project.system.domain.vo.UserAccountRecordOrderSingleItemVO;
import com.qinggeng.project.system.dto.*;
import com.qinggeng.project.system.service.*;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/system/userAccountRecordOrderSingleItem")
@CrossOrigin
public class UserAccountRecordOrderSingleItemController {
    @Resource
    private UserAccountRecordOrderSingleItemService orderSingleItemService;


    //账户记录
    @GetMapping
    //@PreAuthorize("@ss.hasPermi('system:userAccount:list')")
    public AjaxResult listSysUserAccountRecordOrderSingleItemVO(SysUserAccountRecordOrderSingleItemDTO dto){
        List<UserAccountRecordOrderSingleItemVO>  list=orderSingleItemService.listSysUserAccountRecordOrderSingleItemVO(dto);
        return AjaxResult.success(new PageInfo(list));
    }

    //确认单商品退款
    @GetMapping("/agree")
    //@PreAuthorize("@ss.hasPermi('system:userAccount:list')")
    public AjaxResult agree(Long id){
        orderSingleItemService.agree(id);
        return AjaxResult.success();
    }
    //拒绝单商品退款
    @GetMapping("/refuse")
    //@PreAuthorize("@ss.hasPermi('system:userAccount:list')")
    public AjaxResult refuse(Long id){
        orderSingleItemService.refuse(id);
        return AjaxResult.success();
    }

}
